package day11;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Game {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        System.out.print("输入n个裁判：");
        int n=scanner.nextInt();
        user user=new user(n);
        user.end();
    }
}
class user{
    GetScore setScore=new GetScore();
    int n;
    ArrayList<Integer> score=new ArrayList<>();
    user(int n){
        this.n=n;
    }   //

    void setScore(){
        for(int i=0;i<n;i++){
            System.out.print("请输入分数：\n");
            score.add(setScore.getScore());
        }
    }

    void end(){
        setScore();
        int S=0;
        int max = score.get(0),min=score.get(0);
        for(int num:score){
            max= Math.max(max, num);
            min= Math.min(min, num);
            S+=num;
        }
        double V= (double) (S -max-min ) / (n - 2);
        System.out.println("评委的最终平均分为："+V);
        System.out.println();
    }

}
class GetScore{
    int score;
    int getScore(){
        Scanner scanner=new Scanner(System.in);
        score=scanner.nextInt();
        return score;
    }

}